package com.aaa.behind.controller;


import com.aaa.behind.service.IGBrandService;
import com.aaa.entity.BrandMap;
import com.aaa.entity.GBrand;
import com.aaa.util.PageInfo;
import com.aaa.util.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 品牌 前端控制器
 * </p>
 *
 * @author whj
 * @since 2023-01-30
 */
@RestController
@RequestMapping("/g-brand")
public class GBrandController {


    @Autowired
    private IGBrandService igBrandService;


    @PostMapping("findBrandsWithCondition")
    public Result findBrandsWithCondition(@ModelAttribute PageInfo pageInfo, BrandMap map){
        return new Result(igBrandService.findBrandsWithCondition(pageInfo,map));
    }

    @PostMapping("findAllBrands")
    public Result findAllBrands(){
        return new Result(igBrandService.findAllBrands());
    }

    @PostMapping("findAllSort")
    public Result findAllSort(){
        return new Result(igBrandService.findAllSort());
    }

    @PostMapping("deleteBrand")
    public Result deleteBrand(Integer id){
        return new Result(igBrandService.removeById(id));
    }

    @PostMapping("updateState")
    public Result updateState(GBrand gBrand){
        return new Result(igBrandService.updateById(gBrand));
    }


}

